﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sharp.Domain.CMSBoundedContext.AritcleModule.Aggregates
{
    public partial class ArticleRepository
    {
        public bool Exists(string title, out Guid existsArticleId)
        {
            var info = this.Select(x => x.Title == title, t => new { t.Title, t.Id }).FirstOrDefault();
            if (info == null)
            {
                existsArticleId = Guid.Empty;
            }
            else
            {
                existsArticleId = info.Id;
            }
            return info != null;
        }
    }
}